// -----------------------------------------------------------------------
//  <copyright file="IValidateCodeService.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2024 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://www.dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2024-05-08 13:05</last-date>
// -----------------------------------------------------------------------

using DaprPlus.Domain;


namespace DaprPlus.Identity.Domain.Services;

/// <summary>
/// 定义（手机、邮件）验证码服务
/// </summary>
public interface IValidateCodeService
{
    /// <summary>
    /// 生成验证码，一定时间内只生成一次
    /// </summary>
    /// <param name="userInfo">用户关联信息，如用户编号，用户名，Email，手机号等</param>
    /// <param name="type">关联业务类别，如验证登录、重置密码等</param>
    /// <param name="seconds">有效期秒数</param>
    /// <param name="token"></param>
    /// <returns></returns>
    Task<ValidateCode> GenerateAsync(string userInfo, ValidateCodeType type, int seconds, CancellationToken token = default);

    Task<ApiResult> ValidateAsync(string userInfo, ValidateCodeType type, string code, int maxFailCount = 3, CancellationToken token = default);
}

